<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="com.cap.bts.framework.usermgnt.constant.EmployeeStatus"%>    
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>生成优惠券</title>
<%@include file="../include/include.jsp"%>
<%-- <link rel="stylesheet" type="text/css" href="${csspath }/public.css" /> --%>
<script type="text/javascript" src="${layerPath}/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript" src="${layerPath}/layer.js"></script>
<link rel="stylesheet" type="text/css" href="${csspath }/datepicker.css"/>
<script type="text/javascript" src="${jspath }/ui.datepicker_zh-CN.js"></script>
<script type="text/javascript" src="${jspath }/jquery.ui.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="${bootstrapPath}/css/bootstrap.css" />
<script type="text/javascript" src="${bootstrapPath}/js/bootstrap.js"></script>
<style type="text/css"> 
/* 内部样式 */ 
html,body {
	font: 12px "Microsoft YaHei", "Microsoft YaHei", Verdana, Arial,
		sans-serif;
	color: #000;
	width:400px;
	height:400px;
}

.btn {
	/* width: 80px;
	height: 26px;
	color: #000;
	background-color: #ffffff;
	border: 1px solid #ADA9A4;
	cursor: pointer;
	border-radius:0px; */
	display: inline-block;
	padding: 6px 12px;
	margin-bottom: 0;
	font-size: 14px;
	font-weight: normal;
	line-height: 1.42857143;
	text-align: center;
	white-space: nowrap;
	vertical-align: middle;
	-ms-touch-action: manipulation;
	touch-action: manipulation;
	cursor: pointer;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	background-image: none;
	border: 1px solid transparent;
	border-radius: 0px;
	width: 80px;
	color: #fff;
	background-color: #5cb85c;
	border-color: #4cae4c;
}
</style> 
</head>
<script type="text/javascript">
function genrateCoupon(id){
	$.ajax({
		type:'POST',
		url: '${webcontext}/crmdp/dealer/coupon/generateCoupon',
		data : $("#info_form").serialize(),
		/* beforeSend: function(){ 
			showBg('dialog'); 
		}, */
		success : function(data) {
			jAlert('生成成功！', '提示', function() { 
				window.location.href='${webcontext}/crmdp/dealer/coupon/toGenerateCoupon?submitDto.id='+id});
			}
		});
}
function closeLayer(){
	//当你在iframe页面关闭自身时
	/* var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
	parent.layer.close(index); //再执行关闭 */
	//parent.location.reload();
	window.parent.search();
}
</script>

<body>
<div id="content" style="height: 500px;">
		<!-- wrap -->
		<div id="wrap" style="height: 500px;">
		<div class="spliter h_10"></div>           
		<div class="spliter h_5"></div> 
		<form:form id="info_form" action="${webcontext}/crmdp/dealer/coupon/generateCoupon" method="post" modelAttribute="dto">
		  <div class="data_div">
					<table class="table" style="width: 500px;margin-left: 130px;">
						<tr>
							<th width="30%" style="border-top: 0;">市场活动名称</th>
							<td width="70%" style="border-top: 0;">${dto.description}</td>
						</tr>
						<tr>
							<th width="30%" style="border-top: 0;">活动说明</th>
							<td width="70%" style="border-top: 0;">${dto.description}</td>
						</tr>
						<tr>
							<th width="30%" style="border-top: 0;">开始日期</th>
							<td width="70%" style="border-top: 0;">${dto.startDate}</td>
						</tr>
						<tr>
							<th width="30%" style="border-top: 0;">终止日期</th>
							<td width="70%" style="border-top: 0;">${dto.endDate}</td>
						</tr>
							</table>
							</div>
							<div class="spliter h_10"></div>           
			     			 <div class="spliter h_5"></div> 
			     			 
  			<div class="data_div" style="width: 500px;">
				<table class="table" style="width: 500px;">
				<tr>
					<td width="40%" style="padding-left: 60px;">卡片名称</td>
					<td width="30%">数量</td>
					<td width="30%">已生成数量</td>
				</tr>
				<core:forEach items="${batchLineList}" var="lineList" varStatus="status">
				<tr>
					<td style="padding-left: 60px;">
					<input type="hidden" name="lineList[${status.index}].ticket.id" value="${lineList.ticket.id}">
					<input type="hidden" name="lineList[${status.index}].couponBatch.id" value="${lineList.couponBatch.id}">
					${lineList.ticket.ticketName}</td>
					<td><input  name="lineList[${status.index}].num" value="" style="width: 100px;"></td>
					<td class="text-right" style="padding-right: 80px;">${lineList.totalNum}</td>
					</tr>
				</core:forEach>
				</table>
				</div>
							
				<div  style="width:500px;height:50px;text-align: center">
                	<button type="button" class="btn" onClick="genrateCoupon('${dto.id}')" value="生成">
		                <i class="glyphicon glyphicon-ok" style="color:#FFFFFF"></i>&nbsp;生成
	                </button>
					<button type="button" class="btn" onClick="closeLayer()" value="返回">
		                <i class="glyphicon glyphicon-share-alt" style="color:#FFFFFF"></i>&nbsp;返回
	                </button>
        		</div>
		</form:form>
		</div>

            </div>
</body>
</html>